<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增师傅申请配件')" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-serviceOrderParts-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">订单id：</label>
                <div class="col-sm-8">
                    <input name="orderId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">师傅id：</label>
                <div class="col-sm-8">
                    <input name="repairId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">申请状态 1待审核 2待发件 3已发件 4已返件待确认 5审核拒绝 6已完结：</label>
                <div class="col-sm-8">
                    <select name="partsState" class="form-control m-b" th:with="type=${@dict.getType('parts_state')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">拒绝原因：</label>
                <div class="col-sm-8">
                    <textarea name="partsContent" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">整机外形图片：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="imagesMachine">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="imagesMachine" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">整机条码或铭牌图片：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="imagesCode">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="imagesCode" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">故障配件图片 多个用|隔开：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="imagesFault">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="imagesFault" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件人：</label>
                <div class="col-sm-8">
                    <input name="userName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件手机号：</label>
                <div class="col-sm-8">
                    <input name="userPhone" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件地址：</label>
                <div class="col-sm-8">
                    <input name="userAddress" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">快递公司id：</label>
                <div class="col-sm-8">
                    <input name="logisticsId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">快递公司名称：</label>
                <div class="col-sm-8">
                    <input name="logisticsName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">快递单号：</label>
                <div class="col-sm-8">
                    <input name="logisticsNumber" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">物流凭证：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="logisticsProof">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="logisticsProof" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="logisticsRemarks" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否需要返回旧配件 1是 0否：</label>
                <div class="col-sm-8">
                    <select name="isReturn" class="form-control m-b" th:with="type=${@dict.getType('zsyh_yesno')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">厂家收件人：</label>
                <div class="col-sm-8">
                    <input name="factoryName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">厂家收件手机号：</label>
                <div class="col-sm-8">
                    <input name="factoryPhone" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">厂家收件地址 ：</label>
                <div class="col-sm-8">
                    <input name="factoryAddress" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">退回旧配件 快递公司id：</label>
                <div class="col-sm-8">
                    <input name="returnLogisticsId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">退回旧配件 快递公司名称：</label>
                <div class="col-sm-8">
                    <input name="returnLogisticsName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">退回旧配件 快递单号：</label>
                <div class="col-sm-8">
                    <input name="returnLogisticsNumber" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">物流凭证：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="returnLogisticsProof">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="returnLogisticsProof" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="returnLogisticsRemarks" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "zsyh/serviceOrderParts"
        $("#form-serviceOrderParts-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-serviceOrderParts-add').serialize());
            }
        }

        $(".file-upload").fileinput({
            uploadUrl: ctx + 'common/uploadOSS',
            maxFileCount: 1,
            autoReplace: true
        }).on('fileuploaded', function (event, data, previewId, index) {
            $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        })
    </script>
</body>
</html>